package org.example.casemodule.enums;

public enum CertificateAuditStatus {
    //"PENDING","APPROVED","REJECTED"
    PENDING("PENDING", "待审核"),
    APPROVED("APPROVED", "审核通过"),
    REJECTED("REJECTED", "审核拒绝");

    private final String code;
    private final String info;
    CertificateAuditStatus(String code, String info) {
        this.code = code;
        this.info = info;
    }

    public String getCode() {
        return code;
    }

    public String getInfo() {
        return info;
    }

    public static CertificateAuditStatus fromCode(String code) {
        for (CertificateAuditStatus status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown code: " + code);
    }

    public static CertificateAuditStatus fromInfo(String info) {
        for (CertificateAuditStatus status : values()) {
            if (status.info.equals(info)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown info: " + info);
    }

    @Override
    public String toString() {
        return "CertificateAuditStatus{" +
                "code='" + code + '\'' +
                ", info='" + info + '\'' +
                '}';
    }
}
